 {
        
 cc.Class({
            extends: cc.Component,
            properties: {
                taskState: {
                    default: null,
                    type: cc.Sprite
                },
                activityState: {
                    default: null,
                    type: cc.Sprite
                },
                btnRedPacket: {
                    default: null,
                    type: cc.Node
                },
                redpacketBub: {
                    default: null,
                    type: cc.Node
                }
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.MSG_HAPPYBAG5, this.showTaskAndActivityState.bind(this), this);
            },
            start: function () {
            },
            _setRedPointData: function (e, t, n, o) {
                if (n && n.node) {
                    var i = 0, a = 0, r = 0;
                    if (!e || e.length <= 0) console.error("confArr = ", e); else {
                        for (var s = e.length - 1; s >= 0; s--) t && t[e[s].kindId] && e.splice(s, 1);
                        for (var l = 0; l < e.length; l++) for (var c = e[l], d = 0; d < o.length; d++) {
                            var u = o[d];
                            if (c.kindId == u[1]) switch (u[3]) {
                                case 1:
                                    !0, i += 1;
                                    break;

                                case 2:
                                    a++;
                                    break;

                                default:
                                    r += 1;
                            }
                        }
                        var h = 0, f = !1, p = Global.utils.searchComp(n.node, "numLabel", cc.Label);
                        i > 0 ? (f = !1, h = i) : (f = !0, h = r), n.node.active = a != e.length, this._setRedPointShow(n, f, p, h),
                            console.log("_setRedPointData :", i, a, r, h);
                    }
                } else console.error("spRedPoint = ", n);
            },
            _setRedPointShow: function (e, t, n, o) {
                e && (t ? Global.spriteAtlas.setSpriteFrame(e, "Texture/task", "RW_yuandianRed") : Global.spriteAtlas.setSpriteFrame(e, "Texture/task", "RW_yuandianGreen")),
                n && (n.string = o);
            },
            showTaskAndActivityState: function (e) {
                if ("list" == e.action) {
                    for (var t = Global.configCdn.getActivityAndTaskConf() || Global.configCdn.getDefaultConfig("activityAndTask"), n = e.tasks, o = [], i = 0; i < t.taskkinds.length; i++) o.push(t.taskkinds[i]);
                    var a = Global.config.undoKindIdInTask, r = this.taskState;
                    this._setRedPointData(o, a, r, n), o = [];
                    for (var s = 0; s < t.activities.length; s++) o.push(t.activities[s]);
                    if (a = Global.config.undoKindIdInActivity, r = this.activityState, this._setRedPointData(o, a, r, n),
                        this.onRefreshCompleteRedPacket(e, t), this.getOfficialAccountsReward(e), t.videotask) for (var l = t.videotask, c = 0; c < l.length; c++) for (var d = l[c], u = 0; u < n.length; u++) {
                        var h = n[u];
                        d.kindId == h[1] && (Global.config.AlreadyWatchVideoNums = h[4], cc.log("Global.config.AlreadyWatchVideoNums = ", Global.config.AlreadyWatchVideoNums));
                    }
                }
            },
            onRefreshCompleteRedPacket: function (e, t) {
                var n = Global.configCdn.getUISwitchConf(), o = !1;
                n && n.isRookieManRedPacketTask && (o = n.isRookieManRedPacketTask || !1), cc.log("新手屏蔽+++config.isRookieManRedPacketTask", o);
                var i = t.redPacketkinds;
                cc.log("happybag5+++++++++++++333333");
                var a = 0, r = 0;
                if (i) {
                    for (var s = 0; s < i.length; s++) for (var l = i[s], c = 0; c < e.tasks.length; c++) {
                        var d = e.tasks[c];
                        if (l.kindId == d[1]) if (0 == s) {
                            if (a = l.progressMax - d[2], 1 == d[3]) {
                                cc.log("happybag5+++++++++++++11111", a);
                                var u = {
                                    taskId: l.taskId,
                                    kindId: l.kindId,
                                    type: 0
                                };
                                Global.msgHandler.requestGetTaskReward(u);
                            }
                        } else if (r = l.progressMax - d[2], cc.log("happybag5+++++++++++++222222", r, d[2], l),
                        1 == d[3]) {
                            var h = {
                                taskId: l.taskId,
                                kindId: l.kindId,
                                type: 0
                            };
                            Global.msgHandler.requestGetTaskReward(h);
                        }
                    }
                    if (a > 0) cc.log("happybag5+++++++++++++comPleteTask_1 =", a), (f = Global.utils.searchComp(this.btnRedPacket, "redpacketTips", cc.Label)) && (this.redpacketBub.active = o,
                        f.string = "玩" + a + "局可领红包"); else if (r > 0) {
                        var f;
                        cc.log("happybag5+++++++++++++comPleteTask_1 =", r), (f = Global.utils.searchComp(this.btnRedPacket, "redpacketTips", cc.Label)) && (this.redpacketBub.active = o,
                            f.string = "再玩" + r + "局可领红包");
                    } else cc.log("全部完成隐藏提示,提现"), this.redpacketBub.active = !1, Global.config.isHaveRookieManTask = !1;
                }
            },
            getOfficialAccountsReward: function (e) {
                cc.log("happybag5+++++++++++++getOfficialAccountsReward =", e);
                for (var t = 0; t < e.tasks.length; t++) {
                    var n = e.tasks[t];
                    if (cc.log("happybag5+++++++++++++ task[0] =", n[0]), 200292 == n[0] && 1 == n[3]) {
                        var o = {
                            taskId: n[0],
                            kindId: n[1],
                            type: 0
                        };
                        Global.msgHandler.requestGetTaskReward(o);
                        break;
                    }
                }
            },
            onDestroy: function () {
                Global.notificationCenter.offAll(this);
            }
        })
    }